package com.igoal.dao;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.igoal.entity.DataStatus;
import com.igoal.entity.News;

@Repository("newsDAO")
public class NewsDAOImpl extends GenericDaoHibernate<News, Long> implements
		NewsDAO {

	public NewsDAOImpl() {
		super(News.class);
	}

	public List<News> getNewsUsingPaging(Date lastNewsCreateDate, boolean before, int numberOfRecord) {
		Map<String, Object> criteria = new HashMap<String, Object>();
		criteria.put("public", Boolean.TRUE);
		criteria.put("status", DataStatus.USING);
		
		List<News> result = pagingDependOnOrderProperty(criteria, "createDate", lastNewsCreateDate, before, numberOfRecord);
		return result;
	}
}
